/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.inria.openmath.omapi;

/**
 *
 * @author Mr.Sam
 */
public interface ParserErrorHandler {


    /**
     * Receives notification of a warning.
     *
     * <p>OpenMath parsers will use this method to report conditions that
     * are not errors or fatal errors.  The default behaviour is to take no action.</p>
     *
     * <p>The parser must continue to provide normal parsing events
     * after invoking this method: it should still be possible for the
     * application to process the OpenMath object stream through to the end.</p>
     *
     * @param exception The trouble-shouting information encapsulated in a
     *                  OpenMath exception.
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception, possibly
     *            wrapping another exception.
     * @see fr.inria.openmath.omapi.OMException
     */
    public void warning(OMException exception) throws OMException ;


    /**
     * Receives notification of a recoverable error.
     *
     * <p>This corresponds to a more critical error.
     * (For example, a validating parser would use this callback to report
     * the violation of a validity constraint.)
     * The default behaviour is to take no action.</p>
     *
     * <p>The parser must continue to provide normal parsing events
     * after invoking this method: it should still be possible for the
     * application to process the document through to the end.  If the
     * application cannot do so, then the parser should report a fatal
     * error.</p>
     *
     * @param exception The trouble-shouting information encapsulated in a
     *                  OpenMath exception.
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception, possibly
     *            wrapping another exception.
     * @see fr.inria.openmath.omapi.OMException
     */
    public void error(OMException exception) throws OMException ;


    /**
     * Receives notification of a non-recoverable error.
     *
     * <p>This corresponds to a "fatal" error.
     * For example, a parser would use this callback to report the
     * violation of a well-formedness constraint.</p>
     *
     * <p>The application must assume that the document is unusable
     * after the parser has invoked this method, and should continue
     * (if at all) only for the sake of collecting addition error
     * messages: in fact, parsers are free to stop reporting any
     * other events once this method has been invoked.</p>
     *
     * @param exception The trouble-shouting information encapsulated in a
     *                  OpenMath exception.
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception, possibly
     *            wrapping another exception.
     * @see fr.inria.openmath.omapi.OMException
     */
    public void fatalError(OMException exception) throws OMException ;

}
